$(document).ready(function() {
    showMoreInfo($("#div_"), "imgInfo");
});

function validate() {
    $("#formEdit")
        .validate(
        {

            rules : {
                'name' : "required",
                'surname' : "required",
                'countries.country' : "required",
                'regions.region' : "required",
                'cities.city' : "required",
                'mobilePhone' : {
                    required : true
                },
                'email' : {
                    required : true,
                    email : true
                }

            }

        })

}

function fillCountryCode(countryId, url){
    var phone = $("#phone").val();
    if(countryId >= 0 && phone == ""){
        $("#phone").parent().parent().remove();
        $.ajax({
            traditional: true,
            type: "POST",
            url: url,
            data: { "countryId": countryId},
            success: function(result)
            {
                $("#email").parent().parent().after(result);
                $("#addressPhone").val($("#phone").val());
                showMoreInfo($("#div_"), "imgInfo");
            }
        });
    }
}
